

use "$clean/clean_all.dta", clear


		   
loc experiments "click app_main_1day app_main_1week app_main "
		   
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */

	
 xi: qui reg `choice' treatment $contr , vce(r)
    sigstar treatment, prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
	
	qui sum `choice'  
    estadd loc thisstat6 = r(N): col`colnum'
	qui sum `choice'  if treatment==0
	local thisstat7: di %3.2f  `=r(mean)'
	estadd loc thisstat7="`thisstat7'"  : col`colnum'
	

    loc ++colnum
    loc colnames "`colnames' `"`: var la `choice''"'"
	
	
	

	}
	

	

loc rowlabels " " "  " " "Treatment" " " " " "Observations" "Control group mean"   "\hline"" 

loc rowstats ""

forval i = 1/7 {
    loc rowstats "`rowstats' thisstat`i'"
}



esttab * using "$tables/Table_A3.tex", replace cells(none) booktabs nonotes nonum compress alignment(c) nogap noobs nobaselevels label stats(`rowstats',  labels(`rowlabels')  ) ///
   mtitle("click on app-link" "within 24h" "within one week" "any time after survey") ///
   mgroups("Survey" "App Data",  pattern(1 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
